<template>
  <el-dialog destroy-on-close v-model="visible" :title="titlePopup" width="80%">
    <div v-html="describes" class="rich" v-if="!files.length"></div>
    <div>
      <p style="font-size: 18px;">附件：</p>
      <el-link v-for="item in files" @click="downloadFile(item.fileUrl)">{{ item.fileName }}</el-link>
    </div>
  </el-dialog>
</template>

<script setup>
import { ref } from 'vue'
import { msgDetail } from '@/api/spotCheck/spotCheck'

const visible = ref(false)

const describes = ref()
const files = ref([])
const titlePopup = ref()
const show = (id, title) => {
  visible.value = true
  titlePopup.value = title
  msgDetail({ sorgResultPublicityId: id }).then((res) => {
    describes.value = res.data.describes
    files.value = res.data.files
  })
}
const downloadFile = (url) => {
  window.open(url)
}

defineExpose({ show })
</script>

<style scoped lang="scss">
.rich {
  min-height: 80vh;
}
</style>
